package com.github.codemperor.core.token;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * token默认需要带的属性, 作为顶级抽象
 *
 * @author codemperor
 */
public class BaseToken {

    /**
     * 用户id
     */
    private String userId;

    /**
     * 用户名称
     */
    private String userName;

    /**
     * 角色列表
     */
    private List<String> role = new ArrayList<>();

    public void setStringRoleToList(String role) {
        if (role != null && !"".equals(role)) {
            this.role = Arrays.asList(role.split(","));
        }
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public List<String> getRole() {
        return role;
    }

    public void setRole(List<String> role) {
        this.role = role;
    }
}
